STEP 11: What is the slope of this line? Let's ask the user! We'll have to use dot notation.

  • In find the Ask for Float block and drag it into the code editor.
  • Change the string in parentheses to "What is the slope of this line?"
  • Change the variable (the word to the left of the equals sign) from guess to slopeguess.
  • Find the part of the command that says sprite.ask and change it to line.ask().

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_axis(100) stage.create_grid_overlay(10, "grey") stage.set_background("soccerfield") ballx = -80 bally = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) ball = codesters.Sprite("soccerball", ballx, bally) netx = 90 nety = random.randint(-100,100) # sprite = codesters.Sprite("image", x, y) net = codesters.Sprite("soccernet", netx, nety) net.flip_right_left() #sprite = codesters.Line(x-start, y-start, x-end, y-end, "color") line = codesters.Line(ballx, bally, netx, nety, "blue")
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)